#include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct treenode {
	int data;
	struct treenode* left;
	struct treenode* right;
};
typedef struct treenode TREENODE;
struct treenode* build() {
	int k;
	scanf("%d", &k);
	if (k == 0) return NULL;
	struct treenode* root = (TREENODE*)malloc(sizeof(struct treenode));
	root->data = k;
	root->left = build();
	root->right = build();
	return root;
}

   